package com.ttt.map;

import com.ttt.util.Constant;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

/**
 * 玩家的大本营
 */
public class TankHouse {
    //老巢的xy坐标
    public static final int House_X = (Constant.Frame_Width - 3 * MapWall.wallW >> 1) + 2;
    public static final int House_Y = Constant.Frame_Height - 2 * MapWall.wallW;

    //地图块随意定制
    private List<MapWall> walls = new ArrayList<>();
    public TankHouse() {
        walls.add(new MapWall(House_X,House_Y));
        walls.add(new MapWall(House_X,House_Y + MapWall.wallW));
        walls.add(new MapWall(House_X + MapWall.wallW,House_Y));
        walls.add(new MapWall(House_X + MapWall.wallW * 2,House_Y));
        walls.add(new MapWall(House_X + MapWall.wallW * 2,House_Y + MapWall.wallW));
        //作为老巢的块
        walls.add(new MapWall(House_X + MapWall.wallW,House_Y + MapWall.wallW));
        //设置老巢地图块的类型
        walls.get(walls.size() - 1).setType(MapWall.Type_House);
//        walls.get(walls.size() -1).setName(Constant.House_Str);
    }

    public void draw(Graphics g){
        for (MapWall wall : walls) {
            wall.draw(g);
        }
    }

    public List<MapWall> getWalls() {
        return walls;
    }
}
